home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 #2 / Ham Radio 2000 - Volume 2.iso / HAMV2 / MISC / HCAL-27 / NICAD.BAS (.txt) < prev    next >
Encoding:
GW-BASIC  |  1997-01-28  |  6.8 KB  |  233 lines

  1. 10  'NICAD - 18 JUN 92 rev. 27 SEP 96
  2. 20  IF EX$=""THEN EX$="EXIT"
  3. 30  CLS:KEY OFF
  4. 40  COLOR 7,0,1
  5. 50  UL$=STRING$(80,205)
  6. 60  U$="####,###.###"
  7. 70  U1$="####,###"
  8. 80  DIM R(22)         'Radio Shack resistors
  9. 90  '
  10. 100  '.....start
  11. 110  CLS
  12. 120  COLOR 15,2
  13. 130  PRINT " NiCad BATTERY DISCHARGER";TAB(57);"by George Murphy VE3ERP ";
  14. 140  COLOR 1,0:PRINT STRING$(80,223);
  15. 150  COLOR 7,0
  16. 160  PRINT UL$;
  17. 170  '
  18. 180  GOSUB 1600         'display page 1
  19. 190  LOCATE 25,24:COLOR 0,7
  20. 200  PRINT " Press 1 to CONTINUE or 0 to EXIT ";
  21. 210  COLOR 7,0
  22. 220  Z$=INKEY$:IF Z$=""THEN 220
  23. 230  IF Z$="0"THEN CLS:RUN EX$
  24. 240  IF Z$="1"THEN 260
  25. 250  GOTO 220
  26. 260  LOCATE 25,1:PRINT STRING$(80,32);
  27. 270  GOSUB 2200         'screen dump
  28. 280  GOSUB 320          'run calculator program
  29. 290  GOSUB 2200         'screen dump
  30. 300  GOTO 100           'start
  31. 310  '
  32. 320  '.....run
  33. 330  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  34. 340  '.....standard Radio Shack 1/2 watt 10% resistors
  35. 350  DATA 10,22,33,47,100,220,330,470,560,680,1000,1500,2200,4700,5600
  36. 360  DATA 10e3,15e3,22e3,47e3,1e5,1e6,2.2e5
  37. 370   FOR Z=1 TO 22
  38. 380    READ R(Z)
  39. 390   NEXT Z
  40. 400  '
  41. 410  '.....input data
  42. 420  PRINT " Press letter in < > to select a close description of your battery:"
  43. 430  PRINT UL$;
  44. 440  PRINT "  <a>  1.2 volts,  1 cell
  45. 450  PRINT "  <b)  2.4 volts,  2 cells
  46. 460  PRINT "  <c>  3.6 volts,  3 cells
  47. 470  PRINT "  <d>  4.8 volts,  4 cells
  48. 480  PRINT "  <e>  6.0 volts,  5 cells
  49. 490  PRINT "  <f>  7.2 volts,  6 cells
  50. 500  PRINT "  <g>  8.4 volts,  7 cells
  51. 510  PRINT "  <h>  9.6 volts,  8 cells
  52. 520  PRINT "  <i> 10.8 volts,  9 cells
  53. 530  PRINT "  <j> 12.0 volts, 10 cells
  54. 540  PRINT "  <k> more than 12 volts
  55. 550  Z$=INKEY$
  56. 560  IF Z$="a"OR Z$="A"THEN E=1.2
  57. 570  IF Z$="b"OR Z$="B"THEN E=2.4
  58. 580  IF Z$="c"OR Z$="C"THEN E=3.6
  59. 590  IF Z$="d"OR Z$="D"THEN E=4.8
  60. 600  IF Z$="e"OR Z$="E"THEN E=6
  61. 610  IF Z$="f"OR Z$="F"THEN E=7.2
  62. 620  IF Z$="g"OR Z$="G"THEN E=8.4
  63. 630  IF Z$="h"OR Z$="H"THEN E=9.6
  64. 640  IF Z$="i"OR Z$="I"THEN E=10.8
  65. 650  IF Z$="j"OR Z$="J"THEN E=12
  66. 660  IF Z$="k"OR Z$="K"THEN CLS:GOTO 680
  67. 670  IF E THEN 700 ELSE 550
  68. 680  INPUT "ENTER: Voltage of your NiCad battery pack.........................";E
  69. 690  IF E=0 THEN LOCATE CSRLIN-1:PRINT STRING$(79,32):LOCATE CSRLIN-1:GOTO 680
  70. 700  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  71. 710  C=CINT(E/1.2)      'number of cells
  72. 720  DV=C*1             'minimum discharge voltage @ 1 volt per cell
  73. 730  PRINT " What is the power consumption of the device operated by this";
  74. 740  PRINT " battery pack"
  75. 750  PRINT " under normal full load operating conditions ? ........."
  76. 760  PRINT UL$;
  77. 770  PRINT " Press <1> to enter consumption in watts"
  78. 780  PRINT "  -or-"
  79. 790  PRINT " Press <2) to enter power consumption in amperes"
  80. 800  Z$=INKEY$
  81. 810  IF Z$="1"OR Z$="2"THEN 840
  82. 820  GOTO 800
  83. 830  '
  84. 840  '.....calculate resistance
  85. 850  IF Z$="1"THEN Z$="watts"
  86. 860  IF Z$="2"THEN Z$="amps."
  87. 870  PRINT UL$;
  88. 880  PRINT " ENTER: Full load power consumption of the device in ";Z$;
  89. 890  PRINT STRING$(9,46);
  90. 900  INPUT Z
  91. 910  IF Z=0 THEN 880
  92. 920  IF Z$="watts"THEN I=Z/E       'current in amps if watts known
  93. 930  IF Z$="amps."THEN I=Z         'current in amps
  94. 940  R=E/I                         'load resistance of device
  95. 950  P=I*E                         'power consumption of device in watts
  96. 960  CLS
  97. 970  PRINT " Your battery pack is accustomed to operating under the following ";
  98. 980  PRINT "conditions:"
  99. 990  PRINT UL$;
  100. 1000  PRINT " Voltage....................";USING U$;E;
  101. 1010  PRINT "   (";C;"cells @ 1.2 volts each )"
  102. 1020  PRINT " Full load current (amperes)";USING U$;I
  103. 1030  PRINT " Load resistance (ohms).....";USING U$;R
  104. 1040  PRINT " Power consumption (watts)..";USING U$;P
  105. 1050  PRINT UL$;
  106. 1060  PRINT " The battery pack can therefore be discharged safely through a ";
  107. 1070  PRINT "load of not less"
  108. 1080  PRINT " than";CINT(R);:PRINT "ohms with a minumum rating of";
  109. 1090  '
  110. 1100  IF P<0.5 THEN P=0.5:GOTO 1120         'minimum rating 1/2 watt
  111. 1110  IF INT(P)<>P THEN P=INT(P)+1       'round off to next higher integer
  112. 1120  PRINT CINT(P);"watt";
  113. 1130  IF CINT(P)>1 THEN PRINT "s";
  114. 1140  PRINT "."
  115. 1150  PRINT
  116. 1160  PRINT " A suitable load can be made from standard resistors as follows:"
  117. 1170  PRINT UL$;
  118. 1180  '
  119. 1190  '.....calculate quantity of resistors in parallel
  120. 1200  N=INT(P/0.5)+1                      'number of 1/2 watt resistors
  121. 1210  W=N*0.5                             'total wattage rating
  122. 1220  '
  123. 1230  '.....find nearest standard resistor
  124. 1240  X=N/(1/R)                          'net resistance
  125. 1250   FOR Z=1 TO 22
  126. 1260    IF R(Z)>=X THEN 1360
  127. 1270   NEXT Z
  128. 1280  BEEP:CLS
  129. 1290  PRINT " The data you have entered requires a resistor of";X;"ohms.
  130. 1300  PRINT
  131. 1310  PRINT " This value is probably not easily available..........."
  132. 1320  PRINT
  133. 1330  PRINT " Press any key to start over..........."
  134. 1340  IF INKEY$=""THEN 1340 ELSE ERASE R:RESTORE:GOTO 30
  135. 1350  '
  136. 1360  '.....display results
  137. 1370  T=1/(N/R(Z))                      'net resistance
  138. 1380  PRINT " Quantity of resistors......";USING U1$;N;
  139. 1390  PRINT " connected in parallel"
  140. 1400  PRINT " Each resistor..............";USING U1$;R(Z);
  141. 1410  PRINT " ohms, 1/2 watt, 10% tolerance"
  142. 1420  PRINT " Net resistance.............";USING U$;T;:PRINT " ohms"
  143. 1430  PRINT " Power dissipation..........";USING U$;W;:PRINT " watts"
  144. 1440  PRINT
  145. 1450  PRINT " (NOTE: any 1/2 watt resistor from";CINT(X);"to";INT(R(Z));
  146. 1460  PRINT "ohms may be substituted)
  147. 1470  PRINT UL$;
  148. 1480  PRINT " If your device uses more than one cell then discharge all cells ";
  149. 1490  PRINT "together as a"
  150. 1500  PRINT " battery pack unit rather than individually."
  151. 1510  PRINT
  152. 1520  LOCATE CSRLIN,5
  153. 1530  COLOR 15,1
  154. 1540  PRINT " DISCHARGE THE BATTERY PACK TO";DV;"VOLTS";
  155. 1550  PRINT ", BUT NOT LESS before recharging. "
  156. 1560  COLOR 7,0
  157. 1570  PRINT UL$;
  158. 1580  RETURN
  159. 1590  '
  160. 1600  '.....page 1
  161. 1610  VIEW PRINT 3 TO 24:CLS:VIEW PRINT:LOCATE 3
  162. 1620  '.....text
  163. 1630  TB=(8)       'tab for text
  164. 1640  GOSUB 1990   'text block
  165. 1650  PRINT
  166. 1660  PRINT UL$;
  167. 1670  '
  168. 1680  '.....schematic
  169. 1690  R=15   'row
  170. 1700  LOCATE R
  171. 1710  COLOR 0,7
  172. 1720  LOCATE CSRLIN,2:PRINT " + VARPTRSOUNDSOUNDSOUNDBSAVESOUNDBSAVESOUNDBSAVESOUNDBSAVESOUNDBSAVESOUNDSOUNDSOUNDSOUNDCOLOR   "
  173. 1730  LOCATE CSRLIN,2:PRINT " A <0xDF!>  VARPTRMOTORCOLORCALLVARPTRMOTORCOLORCALLVARPTRMOTORCOLOR   CALL   "
  174. 1740  LOCATE CSRLIN,2:PRINT "      CALLRCALLCALLCALLRCALLCALLCALLRCALL   CALL + "
  175. 1750  LOCATE CSRLIN,2:PRINT "      CLSBSAVE'CALLCLSBSAVE'CALLCLSBSAVE'   <0xDF!> C "
  176. 1760  LOCATE CSRLIN,2:PRINT "       CALL CALL CALL CALL CALL  PSETTHENTHENTHEN<0xB5!> "
  177. 1770  LOCATE CSRLIN,2:PRINT "       CALLVARPTRMOTORCOLORCALLVARPTRMOTORCOLORCALL    POINT D "
  178. 1780  LOCATE CSRLIN,2:PRINT "       CALLCALLRCALLCALLCALLRCALLCALL    CALL - "
  179. 1790  LOCATE CSRLIN,2:PRINT " B POINT   CALLCLSBSAVE'CALLCLSBSAVE'CALL    CALL   "
  180. 1800  LOCATE CSRLIN,2:PRINT " - CLSSOUNDSOUNDSOUNDMOTORSOUNDMOTORSOUNDMOTORSOUNDMOTORSOUNDMOTORSOUNDSOUNDSOUNDSOUND'   "
  181. 1810  COLOR 7,0
  182. 1820  '
  183. 1830  '.....legend
  184. 1840  X=28   'column
  185. 1850  LOCATE R,X-1
  186. 1860  PRINT "LEGEND"
  187. 1870  LOCATE R+1,X-1
  188. 1880  PRINT "------"
  189. 1890  LOCATE R+2,X
  190. 1900  PRINT "A,B  Screw heads or pin jacks for voltmeter readings"
  191. 1910  LOCATE R+4,X
  192. 1920  PRINT "C,D  Screw heads spaced to match contacts on battery"
  193. 1930  LOCATE R+6,X-1
  194. 1940  PRINT "PSETTHENTHENTHEN<0xB5!> Elastic band to press battery against C & D"
  195. 1950  LOCATE R+8,X
  196. 1960  PRINT " R   Resistors (program will show values & how many)"
  197. 1970  RETURN
  198. 1980  '
  199. 1990  '.....text block
  200. 2000  PRINT TAB(TB);
  201. 2010  PRINT "NiCad batteries SHOULD NOT be recharged at random. Before"
  202. 2020  PRINT TAB(TB);
  203. 2030  PRINT "recharging they SHOULD be discharged to a level of 1 volt per"
  204. 2040  PRINT TAB(TB);
  205. 2050  PRINT "cell. Battery packs consisting of 2 or more individual 1.2 volt"
  206. 2060  PRINT TAB(TB);
  207. 2070  PRINT "NiCad batteries should NOT be discharged singly, but as a unit."
  208. 2080  PRINT
  209. 2090  PRINT TAB(TB);
  210. 2100  PRINT "Discharging should be through a load that approximates the load"
  211. 2110  PRINT TAB(TB);
  212. 2120  PRINT "that the battery or battery pack is accustomed to operating."
  213. 2130  PRINT
  214. 2140  PRINT TAB(TB);
  215. 2150  PRINT "This program can help you design and build a simple NiCad battery"
  216. 2160  PRINT TAB(TB);
  217. 2170  PRINT "discharger as shown below:"
  218. 2180  RETURN
  219. 2190  '
  220. 2200  'HARDCOPY
  221. 2210  GOSUB 2320:LOCATE 25,2:COLOR 14,6
  222. 2220  PRINT " Press 1 to print screen, 2 to print screen & ";
  223. 2230  PRINT "advance paper, or 3 to continue.";:COLOR 7,0
  224. 2240  Z$=INKEY$:IF Z$="3"THEN GOSUB 2320:RETURN
  225. 2250  IF Z$="1"OR Z$="2"THEN GOSUB 2320:GOTO 2270
  226. 2260  GOTO 2240
  227. 2270  FOR QX=1 TO 24:FOR QY=1 TO 80
  228. 2280  LPRINT CHR$(SCREEN(QX,QY));
  229. 2290  NEXT QY:NEXT QX
  230. 2300  IF Z$="2"THEN LPRINT CHR$(12)
  231. 2310  GOTO 2210
  232. 2320  LOCATE 25,1:PRINT STRING$(80,32);:RETURN
  233.